package com.hzit.controller;

import com.hzit.annotation.RequiresPermissions;
import com.hzit.entity.R;
import com.hzit.service.StudentService;
import com.hzit.vo.StudentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@Controller
@RequestMapping("/student")
public class StudentController {
	@Autowired
	private StudentService studentService;

	//1. 列表学生
	@GetMapping("/list")
	@ResponseBody           // 作用：将R对象转换为字符串并输出到前端
	@RequiresPermissions("student:list11")
	public R list(){
		//1.1 查询所有的学生
		List<StudentVo> studentVos = studentService.findAll();
		//1.2 将学生放到r对象中
		return R.ok(studentVos);
	}

}
